// 处理find相关URL
const FindModel = require('../models/find')
const { stickyNote, correctiontape } = FindModel

let fn_find = async(ctx, next) => {
    let stickyNotes, correctiontapes = [], data = {}
    
    await stickyNote.find((err, doc) => {
        if (err) return console.error(err);
        stickyNotes = doc
    })

    await correctiontape.find((err, doc) => {
        if (err) return console.error(err);
        correctiontapes = doc
    })
    
    data = { productList: [...stickyNotes, ...correctiontapes] }
    ctx.response.body = {
        code: 0,
        data,
        msg: 'ok',
        next: true
    }
}

module.exports = {
    'GET /find': fn_find
}